package org.serg.transcards;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class OverActivity extends Activity {
	Intent intent;

	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.activity_over);

		TextView message = (TextView) findViewById(R.id.OverScore);
		Button continueButton = (Button) findViewById(R.id.gave_continue);
		Button exitButton = (Button) findViewById(R.id.game_over);

		intent = getIntent();
		Bundle request = intent.getExtras();
		if (request != null) {
			/*
			 * Toast.makeText(getApplicationContext(), "Click ListItem " +
			 * request.getString("item"), Toast.LENGTH_LONG) .show();
			 */
			message.setText("Yor score is: " + request.getString("score"));
		}

		continueButton.setOnClickListener(continueListener);
		exitButton.setOnClickListener(exitListener);
	}

	private OnClickListener continueListener = new OnClickListener() {

		public void onClick(View v) {
			intent.putExtra("action", "continue");
			// set result with our selectedColor intent and RESULT_OK request
			// code
			setResult(RESULT_OK, intent);
			// then finish the activity
			OverActivity.this.finish();
		}
	};
	
	private OnClickListener exitListener = new OnClickListener() {

		public void onClick(View v) {
			intent.putExtra("action", "exit");
			// set result with our selectedColor intent and RESULT_OK request
			// code
			setResult(RESULT_OK, intent);
			// then finish the activity
			OverActivity.this.finish();
		}
	};
}
